package com.kujawnode.web;


import com.github.pagehelper.PageInfo;
import com.kujawnode.model.TActivity;
import com.kujawnode.model.TActivityVO;
import com.kujawnode.model.TUser;
import com.kujawnode.query.ActivityQuery;
import com.kujawnode.result.R;
import com.kujawnode.service.ActivityService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version 1.0
 * @Author kujaw
 * @Date 2025/7/17 12:54
 * @注释
 */
@RestController
public class ActivityController {

    @Resource
    private ActivityService activityService;

    /**
     * 活动列表分页查询
     * @param current
     * @return
     */
    @GetMapping(value="/api/activities")
    public R activityPage(@RequestParam(value="current",required = false) Integer current,
                          ActivityQuery  activityQuery){
        if(current == null){
            current = 1;
        }
        PageInfo<TActivityVO> pageInfo = activityService.getActivityByPage(current,activityQuery);
        return R.OK(pageInfo);
    }



}
